#include <stdio.h>
#include "main.h"
#include "mem.h"
#include "uart.h"
#include "funcBlock.h"
#include "funcBlock_NOT.h"

struct fb_NOT
{
	uint8_t type;
	function_t func;
	uint8_t in0;
	uint8_t out0;
};

// ****************** FunctionBlock NOT 1xIn 1xOut *******************

void function_fb_NOT(struct funcBlock_t *_fb)
{
	struct fb_NOT *fb = (struct fb_NOT*)_fb;

	setState(fb->out0, !getState(fb->in0));
}

struct funcBlock_t* get_fb_NOT(uint8_t net_in, uint8_t net_out)
{
	struct fb_NOT *fb = NULL;

	fb = (struct fb_NOT*)getMem(sizeof(struct fb_NOT));
	if (fb != NULL)
	{
		//uart_puts("NOT\n");
		fb->type = FB_TYPE_NOT;
		fb->func = function_fb_NOT;
		fb->in0 = net_in;
		fb->out0 = net_out;
	}
	return (struct funcBlock_t*)fb;
}
